#Skripta ki skrbi za nadgradnjo skript
import System
import System.Threading
import clr
import time
import sys
#sys.path.append("c:\\Program Files (x86)\\IronPython 2.7\\Lib\\")

from System.IO import Directory, StreamReader
from System.Text.RegularExpressions import Regex
from ftplib import FTP

#print Directory.GetCurrentDirectory()
#for datoteke in Directory.GetFiles(Directory.GetCurrentDirectory()):
#    if (datoteke.ToString().Contains(".py")):
#        reader = StreamReader(datoteke.ToString())
#        vsebina = reader.ReadToEnd()
#        text = Regex("IT_VERZIJA = \"(.*?)\"")
#        verzija = text.Match(vsebina)
#        print ("%s: %s" %(datoteke.ToString(), verzija.Groups[1].Value))
#        reader.Close()

def nadgradi():
        ftp = FTP('iete01', 'anonymous', 'iskratel')
        ftp.cwd("/skripte/")
        stavek = "PRIDOBIL NASLEDNJE SKRIPTE: "

        for filename in ftp.nlst("*.*"):
            fhandle = open(filename, 'wb')
            #print 'Getting ' + filename
            ftp.retrbinary('RETR ' + filename, fhandle.write)
            stavek += "%s " %filename
            fhandle.close()
        ftp.quit()
        print(stavek)

